<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="UTF-8" />
  <title>河职文章生成</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
  <link rel="stylesheet" href="sdk/antd.css" />
  <link rel="stylesheet" href="sdk/helper.css" />
  <link rel="stylesheet" href="sdk/iconfont.css" />
  <!-- 这是默认主题所需的，如果是其他主题则不需要 -->
  <!-- 从 1.1.0 开始 sdk.css 将不支持 IE 11，如果要支持 IE11 请引用这个 css，并把前面那个删了 -->
  <!-- <link rel="stylesheet" href="sdk-ie11.css" /> -->
  <!-- 不过 amis 开发团队几乎没测试过 IE 11 下的效果，所以可能有细节功能用不了，如果发现请报 issue -->
  <style>
    html,
    body,
    .app-wrapper {
      position: relative;
      width: 100%;
      height: 100%;
      margin: 0;
      padding: 0;
    }
  </style>
</head>

<body>
  <div id="root" class="app-wrapper"></div>
  <script src="sdk/sdk.js"></script>
  <script type="text/javascript">
    (function () {
      let amis = amisRequire('amis/embed');
      // 通过替换下面这个配置来生成不同页面
      let amisJSON = {
        "type": "page",
        "title": "首页",
        "id": "u:c9f56ae3a955",
        "aside": [],
        "toolbar": [],
        "asideResizor": false,
        "pullRefresh": {
          "disabled": true
        },
        "regions": [
          "body",
          "toolbar",
          "header"
        ],
        "body": [
          {
            "id": "u:b643648070fd",
            "type": "form",
            "title": "文章信息",
            "mode": "horizontal",
            "dsType": "api",
            "feat": "Insert",
            "body": [
              {
                "name": "test",
                "label": "专业名称",
                "type": "input-text",
                "required": true, 
                "id": "u:b3f24794f82d"
              },
              {
                "name": "test2",
                "label": "论文题目",
                "type": "input-text",
                "required": true,
                "id": "u:fe825e8068a7"
              }
            ],
            "api": {
              "url": "http://127.0.0.1:6851/api/sub",
              "method": "post",
              "requestAdaptor": "(data) => {return {data: JSON.stringify({test: data.test, test2: data.test2})}}",
              "adaptor": "",
              "messages": {
                "failed": "提交失败",
                "success": "提交成功"
              },
              "dataType": "json",
              "silent": false,
              "replaceData": false,
              "headers": {
                "Content-Type": "application/json"
              },
              "data": {
                "&": "$$"
              }
            },
            "actions": [
              {
                "type": "button",
                "label": "提交",
                "onEvent": {
                  "click": {
                    "actions": [
                      {
                        "actionType": "submit",
                        "componentId": "u:b643648070fd"
                      }
                    ]
                  }
                },
                "level": "primary",
                "id": "u:f438a877f550"
              }
            ],
            "resetAfterSubmit": true
          }
        ]
      };
      let amisScoped = amis.embed('#root', amisJSON, null, { theme: 'antd' });
    })();
  </script>
</body>

</html>